﻿using UnityEngine;
using System.Collections;

public class EnemySpawnPointTerrestre1 : MonoBehaviour {
	
	public GameObject enemy;
	public GameObject mainCamera;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if((mainCamera.transform.position.x - this.transform.position.x) > 50)
		{
			instantiateEnemy();
		}
	
	}
	
	void instantiateEnemy(){
		
		GameObject.Instantiate(enemy, new Vector3(transform.position.x, transform.position.y, transform.position.z), transform.rotation);
		
	}
}
